import axios from '../../axios'

/* 
 * 角色管理模块
 */

 // 搜索
export const queryByName = (data) => {
    return axios({
        url: '/kysj/user/role/findByName?roleName='+ data,
        method: 'get',
    })
}

// 查询所有角色表
export const findAll = () => {
    return axios({
        url: '/kysj/user/role/findAll',
        method: 'get',
    })
}

// 添加
export const addRole = (data) => {
    return axios({
        url: '/kysj/user/role/addRole',
        method: 'put',
        data
    })
}

// 编辑
export const updateRole = (data) => {
    return axios({
        url: '/kysj/user/role/updateRole',
        method: 'post',
        data
    })
}

// 删除
export const deleteRole = (data) => {
    return axios({
        url: '/kysj/user/role/deleteRole?roleId=' + data,
        method: 'delete',
    })
}


// 分页查询
export const findByPage = (page,pageSize) => {
    return axios({
        url: '/kysj/user/role/findByPage/'+page+'/'+pageSize+'/',
        method: 'get',
    })
}


// 查询角色权限
export const queryRoleRel = () => {
    return axios({
        url: '/kysj/user/role/queryRoleRel',
        method: 'get',
    })
}


// 查询角色
export const queryRoleRelById = (data) => {
    return axios({
        url: '/kysj/user/role/queryRoleRelById?roleId=' + data,
        method: 'get',
    })
}

// 查询角色菜单集合
export const findRoleMenus = () => {
    return axios({
        url: '/kysj/user/role/findRoleMenus',
        method: 'get',
    })
}

// 保存角色菜单集合
export const saveRoleMenus = (data) => {
    return axios({
        url: '/kysj/user/role/saveRoleMenus',
        method: 'post',
        data
    })
}

// 查询总量
export const count = () => {
    return axios({
        url: '/kysj/user/role/count',
        method: 'get',
    })
}